package com.eddie.jdbc.app;

import com.eddie.jdbc.exception.BizCodeEnum;
import com.eddie.jdbc.service.AccountService;
import com.eddie.jdbc.service.impl.AccountServiceImpl;
import com.eddie.jdbc.vo.AccountVo;
import com.eddie.jdbc.vo.R;
import com.eddie.jdbc.vo.params.FindAccountParams;

/**
 * @author Eddie
 * @date 2022/3/3 16:04
 */
public class AccountController {

    private AccountService accountService = new AccountServiceImpl();

    public R loginAccount(FindAccountParams params) {
        AccountVo accountVo = accountService.findByUserNameAndPassword(params);
        return accountVo == null ? R.error(BizCodeEnum.CHECK_ACCOUNT_EXCEPTION.getCode(),
                BizCodeEnum.CHECK_ACCOUNT_EXCEPTION.getMsg())
                : R.ok().setData(accountVo);
    }

}
